package cn.itsource.zcn.org.service.impl;

import cn.itsource.zcn.org.domain.Systemdictionarydetail;
import cn.itsource.zcn.org.domain.Systemdictionarytype;
import cn.itsource.zcn.org.mapper.SystemdictionarydetailMapper;
import cn.itsource.zcn.org.query.SystemdictionarydetailQuery;
import cn.itsource.zcn.org.service.ISystemdictionarydetailService;
import cn.itsource.zcn.utils.QueryResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;


import java.util.List;

/**
 * (Systemdictionarydetail)表服务实现类
 *
 * @author makejava
 * @since 2021-08-14 09:12:08
 */
@Service
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public class SystemdictionarydetailServiceImpl implements ISystemdictionarydetailService {
    @Autowired
    private SystemdictionarydetailMapper tSystemdictionarydetailMapper;


    /**
     * 新增数据
     *
     * @param tSystemdictionarydetail 实例对象
     */
    @Override
    @Transactional
    public void save(Systemdictionarydetail tSystemdictionarydetail) {
        tSystemdictionarydetailMapper.save(tSystemdictionarydetail);
    }

    /**
     * 修改数据
     *
     * @param tSystemdictionarydetail 实例对象
     */
    @Override
    @Transactional
    public void update(Systemdictionarydetail tSystemdictionarydetail) {
        tSystemdictionarydetailMapper.update(tSystemdictionarydetail);
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     */
    @Override
    @Transactional
    public void delete(Long id) {
        tSystemdictionarydetailMapper.delete(id);
    }

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public Systemdictionarydetail queryById(Long id) {
        return tSystemdictionarydetailMapper.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @return 对象列表
     */
    @Override
    public List<Systemdictionarydetail> queryAll() {
        return tSystemdictionarydetailMapper.queryAll();
    }

    @Override
    public QueryResult<Systemdictionarydetail> queryPage(SystemdictionarydetailQuery systemdictionarydetailQuery) {
        Integer count = tSystemdictionarydetailMapper.count(systemdictionarydetailQuery);
        if(count == 0){
            return new QueryResult<>();
        }
        List<Systemdictionarydetail> list = tSystemdictionarydetailMapper.pageQuery(systemdictionarydetailQuery);
        return new QueryResult<Systemdictionarydetail>(list,count);
    }

    @Override
    public void deleteBatch(List<Integer> ids) {
        tSystemdictionarydetailMapper.deleteBatch(ids);
    }


}
